/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ass09;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "agents", catalog = "travelexperts", schema = "")
@NamedQueries({
    @NamedQuery(name = "Agents.findAll", query = "SELECT a FROM Agents a"),
    @NamedQuery(name = "Agents.findByAgentId", query = "SELECT a FROM Agents a WHERE a.agentId = :agentId"),
    @NamedQuery(name = "Agents.findByAgtFirstName", query = "SELECT a FROM Agents a WHERE a.agtFirstName = :agtFirstName"),
    @NamedQuery(name = "Agents.findByAgtMiddleInitial", query = "SELECT a FROM Agents a WHERE a.agtMiddleInitial = :agtMiddleInitial"),
    @NamedQuery(name = "Agents.findByAgtLastName", query = "SELECT a FROM Agents a WHERE a.agtLastName = :agtLastName"),
    @NamedQuery(name = "Agents.findByAgtBusPhone", query = "SELECT a FROM Agents a WHERE a.agtBusPhone = :agtBusPhone"),
    @NamedQuery(name = "Agents.findByAgtEmail", query = "SELECT a FROM Agents a WHERE a.agtEmail = :agtEmail"),
    @NamedQuery(name = "Agents.findByAgtPosition", query = "SELECT a FROM Agents a WHERE a.agtPosition = :agtPosition"),
    @NamedQuery(name = "Agents.findByAgencyId", query = "SELECT a FROM Agents a WHERE a.agencyId = :agencyId")})
public class Agents implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "AgentId")
    private Integer agentId;
    @Column(name = "AgtFirstName")
    private String agtFirstName;
    @Column(name = "AgtMiddleInitial")
    private String agtMiddleInitial;
    @Column(name = "AgtLastName")
    private String agtLastName;
    @Column(name = "AgtBusPhone")
    private String agtBusPhone;
    @Column(name = "AgtEmail")
    private String agtEmail;
    @Column(name = "AgtPosition")
    private String agtPosition;
    @Column(name = "AgencyId")
    private Integer agencyId;

    public Agents() {
    }

    public Agents(Integer agentId) {
        this.agentId = agentId;
    }

    public Integer getAgentId() {
        return agentId;
    }

    public void setAgentId(Integer agentId) {
        Integer oldAgentId = this.agentId;
        this.agentId = agentId;
        changeSupport.firePropertyChange("agentId", oldAgentId, agentId);
    }

    public String getAgtFirstName() {
        return agtFirstName;
    }

    public void setAgtFirstName(String agtFirstName) {
        String oldAgtFirstName = this.agtFirstName;
        this.agtFirstName = agtFirstName;
        changeSupport.firePropertyChange("agtFirstName", oldAgtFirstName, agtFirstName);
    }

    public String getAgtMiddleInitial() {
        return agtMiddleInitial;
    }

    public void setAgtMiddleInitial(String agtMiddleInitial) {
        String oldAgtMiddleInitial = this.agtMiddleInitial;
        this.agtMiddleInitial = agtMiddleInitial;
        changeSupport.firePropertyChange("agtMiddleInitial", oldAgtMiddleInitial, agtMiddleInitial);
    }

    public String getAgtLastName() {
        return agtLastName;
    }

    public void setAgtLastName(String agtLastName) {
        String oldAgtLastName = this.agtLastName;
        this.agtLastName = agtLastName;
        changeSupport.firePropertyChange("agtLastName", oldAgtLastName, agtLastName);
    }

    public String getAgtBusPhone() {
        return agtBusPhone;
    }

    public void setAgtBusPhone(String agtBusPhone) {
        String oldAgtBusPhone = this.agtBusPhone;
        this.agtBusPhone = agtBusPhone;
        changeSupport.firePropertyChange("agtBusPhone", oldAgtBusPhone, agtBusPhone);
    }

    public String getAgtEmail() {
        return agtEmail;
    }

    public void setAgtEmail(String agtEmail) {
        String oldAgtEmail = this.agtEmail;
        this.agtEmail = agtEmail;
        changeSupport.firePropertyChange("agtEmail", oldAgtEmail, agtEmail);
    }

    public String getAgtPosition() {
        return agtPosition;
    }

    public void setAgtPosition(String agtPosition) {
        String oldAgtPosition = this.agtPosition;
        this.agtPosition = agtPosition;
        changeSupport.firePropertyChange("agtPosition", oldAgtPosition, agtPosition);
    }

    public Integer getAgencyId() {
        return agencyId;
    }

    public void setAgencyId(Integer agencyId) {
        Integer oldAgencyId = this.agencyId;
        this.agencyId = agencyId;
        changeSupport.firePropertyChange("agencyId", oldAgencyId, agencyId);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (agentId != null ? agentId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Agents)) {
            return false;
        }
        Agents other = (Agents) object;
        if ((this.agentId == null && other.agentId != null) || (this.agentId != null && !this.agentId.equals(other.agentId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ass09.Agents[ agentId=" + agentId + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
